<template>
  <div>
    <div class="article-pane clearfix flex flex-h" v-for="(item, index) in listDatas" :key="index">
      <div class="article-info-pane alpha flex flex-h-reverse">
        <ul>
          <li class="date-show">
            <div class="year-month" style="font-size: 13px">
              <div>{{new Date(item.createDate).getFullYear()}}</div>
              <div>{{new Date(item.createDate).getMonth()+1}}月</div>
            </div>
            <div class="day-show">
              {{new Date(item.createDate).getDate()}}
            </div>
          </li>
          <li style="font-size: 14px">字数({{item.fontNum}})</li>
        </ul>
      </div>
      <div class="article-content-pane">
        <div class="content-title">{{item.title}}</div>
        <div class="content-desc" v-html="convertMarkdown(item.content)"></div>
        <div class="detail-btn" style="font-size: 14px"><a @click.prevent="searchArticle(item)">查看详情</a></div>
      </div>
    </div>
  </div>
</template>

<script>
import marked from 'marked/lib/marked'
export default {
  props: {
    listDatas: ''
  },
  mounted () {
  },
  data () {
    return {

    }
  },
  methods: {
    convertMarkdown (content) {
      return marked(content)
    },
    searchArticle (item) {
      this.$router.push({ path: `/specificArticle/${item.nodeId}` })
    }
  }
}
</script>

<style scoped>
  .article-pane {
    color: rgba(255,255,255,.7);
    margin-top: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(166,166,166,0.3);
  }
  .article-info-pane ul {
    list-style: none;
    width: 90px;
    padding: 0px;
    margin: 0px;
    margin-right: 15px
  }
  .article-info-pane ul li {
    font-size: 14px;
    text-align: right;
  }
  .date-show div {
    display: inline-block;
  }
  .article-content-pane {
    position: relative;
  }
  .content-title {
    font-size: 18px;
    margin-bottom: 10px;
  }
  .content-desc {
    font-size: 14px;
  }
  .detail-btn {
    position: absolute;
    right: 0px;
  }
  .date-show {
    display: block;
  }
  .date-show div {
    display: inline-block;
  }
  .year-month {
    font-size: 14px;
  }
  .year-month div {
    display: block;
  }
  .day-show {
    font-size: 45px;
  }

</style>
